First, import and tidy data:
gender neighborhood VS hiv
neb_plot = hiv_data %>%
group_by(neighborhood, gender) %>%
<<<<<<< HEAD
filter(age != "All") %>%
=======
filter(age != "All") %>%
>>>>>>> f0c38606b3f150183d744918c518b92f84d8e764
summarise(sum_hiv = sum(hiv_diagnoses)) %>%
ggplot(aes(x = reorder(neighborhood, sum_hiv), y = sum_hiv, color = gender)) +
coord_flip() +
geom_point() +
labs(
title = "Gender and Neighborhood Influence on HIV Incidence",
x = "Neighborhood",
y = "HIV diagnoses",
caption = "Data from the ..."
)
ggplotly(neb_plot)
<<<<<<< HEAD
=======
>>>>>>> f0c38606b3f150183d744918c518b92f84d8e764
age_plot = hiv_data %>%
filter(age != "All") %>%
group_by(gender, age) %>%
summarise(sum_hiv = sum(hiv_diagnoses)) %>%
ggplot(aes(y = sum_hiv, x = age, fill = gender)) +
geom_bar(stat="identity", alpha = 0.8, position = position_dodge()) +
scale_fill_brewer(palette="Dark2") +
labs(
title = "Gender and Age Influence on HIV Incidence",
x = "Age range",
y = "HIV diagnoses",
caption = "Data from the ..."
)
ggplotly(age_plot)
<<<<<<< HEAD
=======
>>>>>>> f0c38606b3f150183d744918c518b92f84d8e764
race_plot = hiv_data %>%
filter(race != "All") %>%
group_by(gender, race) %>%
summarise(sum_hiv = sum(hiv_diagnoses)) %>%
ggplot(aes(y = sum_hiv, x = reorder(race, sum_hiv), fill = gender)) +
geom_bar(stat="identity", alpha = 0.8, position = position_dodge()) +
scale_fill_manual(values = c("#E69F00", "#56B4E9")) +
labs(
title = "Race and Gender Influence on HIV Incidence",
x = "Race",
y = "HIV diagnoses",
caption = "Data from the ..."
)
ggplotly(race_plot)
<<<<<<< HEAD
hiv_data %>%
group_by(borough) %>%
summarize(sum_hiv = sum(hiv_diagnoses)) %>%
arrange(desc(sum_hiv))
## # A tibble: 5 x 2
## borough sum_hiv
## <chr> <int>
## 1 Brooklyn 11409
## 2 Manhattan 10485
## 3 Bronx 8193
## 4 Queens 6957
## 5 Staten Island 648
year_plot = hiv_data %>%
mutate(year = as.integer(year)) %>%
filter(borough == "Brooklyn" & gender == "Male" & age == "20 - 29") %>%
=======
Years in Bronx young (20-29) male
year_plot = hiv_data %>%
mutate(year = as.integer(year)) %>%
filter(borough == "Bronx" & gender == "Male" & age == "20 - 29") %>%
>>>>>>> f0c38606b3f150183d744918c518b92f84d8e764
group_by(year, neighborhood) %>%
summarize(sum_hiv = sum(hiv_diagnoses)) %>%
ggplot(aes(x = year, y = sum_hiv, color = neighborhood)) +
geom_line()
ggplotly(year_plot)
<<<<<<< HEAD
=======
>>>>>>> f0c38606b3f150183d744918c518b92f84d8e764